<?php

class AdminController extends CController {
    
    public function actionLogin(){
        $this->layout = false;
        $model = new LoginForm();
        if(isset($_POST['LoginForm'])){
            $model->attributes=$_POST['LoginForm'];
            if($model->validate() && $model->login()){
                $this->redirect(Yii::app()->createUrl('product/index'));
            }
        }
        $this->render("login",array('model' => $model));
    }
    
    /**
     * 
     */
    public function actionLogout(){
        Yii::app()->user->logout();
        $this->redirect(Yii::app()->homeUrl);
    }
}